package eg.backend.manager;

import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import eg.backend.domain.Dimension;

@Transactional
public interface DimensionManager {	
	@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
	List<Dimension> getUserDimensions();
	
	//get dimensions provided by SYSTEM that he has selected
	@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
	List<Dimension> getSystemDimensions();

	@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
	List<Dimension> getSystemSharedDimensions();
	
	//get dimensions shared by others that customer has right to see
	@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
	List<Dimension> getOthersDimensions();

	@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
	List<Dimension> getSelfSharedDimensions();
		
	//get dimensions of "owner" that "customer" has right to see
	@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
	List<Dimension> getAvailableDimensions(String owner);	
	
	//for expense input, call repository
//	List<Dimension> findAvailByParent(String parent, String user);
	
	void updateWithChildren(Dimension parent, List<Dimension> children, List<Dimension> todelete);
	
	/* update */
	
	Dimension addDimension(Dimension dimension);

	void deleteDimension(Dimension dimension);

	void deleteDimension(String dimensionId);

	void updateDimensionShare(List<Dimension> dimensions);
	List<Dimension> getDeleted(Dimension dim);
	Dimension update(Dimension rootDimension);
	
	Dimension save(Dimension dimension);
}
